package ch.zbw.pra.sysventory.ui.gui.panels.scanpanel;

import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;

import ch.zbw.pra.sysventory.ui.gui.panels.scanpanel.subpanels.ProgressbarPanel;
import ch.zbw.pra.sysventory.ui.gui.panels.scanpanel.subpanels.ScanButtonPanel;
import ch.zbw.pra.sysventory.ui.gui.utilities.GuiLayout;

public class ScanPanel extends JPanel {

	private static final long serialVersionUID = 6238975717211977609L;

	private ScanButtonPanel scanButtonPanel;
	private ProgressbarPanel progressBarPanel;

	public ScanPanel() {
		this.progressBarPanel = new ProgressbarPanel();
		this.scanButtonPanel = new ScanButtonPanel(this.progressBarPanel);
		init();
	}

	public void init() {
		JPanel placeholderPanel = new JPanel();
		GridBagLayout gridBagLayout = GuiLayout.getGridBagLayout(placeholderPanel);
		GridBagConstraints gridBagConstraints = GuiLayout.getGridBagConstraints();
		gridBagConstraints.insets = new Insets(100, 150, 100, 50);
		gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 1.0 };
		gridBagLayout.columnWidths = new int[] { 150 };
		int x = 0;
		int y = 0;

		GuiLayout.addToLayout(placeholderPanel, gridBagLayout, gridBagConstraints, x, y++, this.scanButtonPanel);
		x = 0;
		y++;
		gridBagConstraints.insets = new Insets(5, 5, 5, 5);
		GuiLayout.addToLayout(placeholderPanel, gridBagLayout, gridBagConstraints, x, y++, 2, 2, this.progressBarPanel);
		x = 0;
		y++;
		GuiLayout.addToLayout(placeholderPanel, gridBagLayout, gridBagConstraints, x, y++, new JLabel());
		this.add(placeholderPanel, BorderLayout.CENTER);
	}

}
